<?php
namespace app\api\controller\v1;

use think\Request;


class pay extends Base
{
	public function _initialize()
	{
		parent::_initialize();
	}



    public function zhifubaotixian(){
        require_once './aop/AopClient.php';
        require_once './aop/AopCertClient.php';
        require_once './aop/AopCertification.php';
        require_once './aop/AlipayConfig.php';
        require_once './aop/request/AlipayFundTransUniTransferRequest.php';


        $privateKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqlT+X14ZLp68WLH1hYhjcBYL6XyHVFJp6epr39S5qEU1xjxlpTuDBSoQTyq34P4r6MvuYSiDEpqaGb6DISoc+SSLEmZGV0cPUvXrP4iZ45N54+cihMm7oo13njdQpSQrnTtNO/AdVbL3tlo+KSalzbOgu2r6RZoNSOD1WlBmrYlhF77AC9MOZN5tAAGvhyFsURxWh7t0sYojuS6sZx1Tw+Wv/puEQgEPPsEmmJ0rr+xlhTHuG4e80dbC77GYjbhm8CFIYsH4QOwSr1jjAdYfcOGcfjvgIloYx0s3bRRn4BHTP0Fldpd1AO1RrKQYEjSU7BcwXg0Zr3kL+MXCz7owtwIDAQAB";
        $alipayConfig = new AlipayConfig();
        $alipayConfig->setPrivateKey($privateKey);
        $alipayConfig->setServerUrl("https://openapi.alipay.com/gateway.do");
        $alipayConfig->setAppId("2021003175659216");
        $alipayConfig->setCharset("UTF8");
        $alipayConfig->setSignType("RSA2");
        $alipayConfig->setEncryptKey("");
        $alipayConfig->setFormat("json");
        $alipayConfig->setAppCertPath("<-- 请填写您的应用公钥证书文件路径，例如：/foo/appCertPublicKey_2019051064521003.crt -->");
        $alipayConfig->setAlipayPublicCertPath("<-- 请填写您的支付宝公钥证书文件路径，例如：/foo/alipayCertPublicKey_RSA2.crt -->");
        $alipayConfig->setRootCertPath("<-- 请填写您的支付宝根证书文件路径，例如：/foo/alipayRootCert.crt -->");
        $alipayClient = new AopCertClient($alipayConfig);
        $alipayClient->isCheckAlipayPublicCert = true;
        $request = new AlipayFundTransUniTransferRequest();
        $request->setBizContent("{".
            "\"out_biz_no\":\"201806300001\",".
            "\"remark\":\"201905代发\",".
            "\"business_params\":\"{\\\"payer_show_name_use_alias\\\":\\\"true\\\"}\",".
            "\"biz_scene\":\"DIRECT_TRANSFER\",".
            "\"payee_info\":{".
            "\"identity\":\"2088123412341234\",".
            "\"identity_type\":\"ALIPAY_USER_ID\",".
            "\"name\":\"黄龙国际有限公司\"".
            "},".
            "\"trans_amount\":\"23.00\",".
            "\"product_code\":\"TRANS_ACCOUNT_NO_PWD\",".
            "\"order_title\":\"201905代发\"".
            "}");
        $responseResult = $alipayClient->execute($request);
        $responseApiName = str_replace(".","_",$request->getApiMethodName())."_response";
        $response = $responseResult->$responseApiName;
        if(!empty($response->code)&&$response->code==10000){
            echo("调用成功");
        }
        else{
            echo("调用失败");
        }

    }

    public function callback(Request $request){
        $info = $request->param();
        dump($info);

    }
    
}